
package jp.mylyane.afx.logger;




/**<pre>
 *</pre>
 */
public abstract class XLogger
{
	// ---------------------------------------------------------------------------------------
	//
	//                                Static implementation.
	//
	// ---------------------------------------------------------------------------------------
	public static String GetInvokeClassName(int more_depth) {
		return GetStackTraceElement(2 + 1 + more_depth).getClassName();
    }
	public static StackTraceElement GetStackTraceElement(int depth) {
		StackTraceElement[] ste_arry = Thread.currentThread().getStackTrace();
		return ste_arry[depth];
	}
	// Logger log = LogManager.getLogger();
	/**
	 * <pre>
	 * </pre>
	 * @return
	 */
	public static XLogger GetLogger() {
		return GetLogger( GetInvokeClassName(1) );
	}
	/**
	 * <pre>
	 * </pre>
	 * @param className
	 * @return
	 */
	public static XLogger GetLogger(String className) {
		if (className == null || className.length() == 0)
			className = GetInvokeClassName(1);
		try {
			XLogger logger = new ActualLogger(className);
			logger.trace("Created ActualLogger, order class={}", className);
			return logger;
		}
		catch (NoClassDefFoundError e) {
//			System.out.println( e.getMessage() );
			e.printStackTrace();
			System.out.println("OK, now create Empty Logger as emergency");
			return new EmptyLogger();
		}
	}



	// ---------------------------------------------------------------------------------------
	//
	//                                instance implementation.
	//
	// ---------------------------------------------------------------------------------------
	/**<pre>
	 * </pre>
	 */
	public XLogger() {}

	// ---------------------------------------------------------------------------------------
	//
	//                                    interface Logger.
	//
	// ---------------------------------------------------------------------------------------
	/*
	 * @see org.apache.logging.log4j.Logger#catching(java.lang.Throwable)
	 */
	public abstract void catching(Throwable t);
	/*
	 * @see org.apache.logging.log4j.Logger#debug(java.lang.Object)
	 */
	public abstract void debug(Object message);
	
	/*
	 * @see org.apache.logging.log4j.Logger#debug(java.lang.Object, java.lang.Throwable)
	 */
	public abstract void debug(Object message, Throwable t);
	
	/*
	 * @see org.apache.logging.log4j.Logger#debug(java.lang.String)
	 */
	public abstract void debug(String message);
	
	/*
	 * @see org.apache.logging.log4j.Logger#debug(java.lang.String, java.lang.Object[])
	 */
	public abstract void debug(String message, Object... params);
	
	/*
	 * @see org.apache.logging.log4j.Logger#debug(java.lang.String, java.lang.Throwable)
	 */
	public abstract void debug(String message, Throwable t);
	
	/*
	 * @see org.apache.logging.log4j.Logger#entry()
	 */
	public abstract void entry();
	
	/*
	 * @see org.apache.logging.log4j.Logger#entry(java.lang.Object[])
	 */
	public abstract void entry(Object... params);
	/*
	 * @see org.apache.logging.log4j.Logger#error(java.lang.Object)
	 */
	public abstract void error(Object message);
	
	/*
	 * @see org.apache.logging.log4j.Logger#error(java.lang.Object, java.lang.Throwable)
	 */
	public abstract void error(Object message, Throwable t);
	
	/*
	 * @see org.apache.logging.log4j.Logger#error(java.lang.String)
	 */
	public abstract void error(String message);
	
	/*
	 * @see org.apache.logging.log4j.Logger#error(java.lang.String, java.lang.Object[])
	 */
	public abstract void error(String message, Object... params);
	
	/*
	 * @see org.apache.logging.log4j.Logger#error(java.lang.String, java.lang.Throwable)
	 */
	public abstract void error(String message, Throwable t);
	
	/*
	 * @see org.apache.logging.log4j.Logger#exit()
	 */
	public abstract void exit();
	
	/*
	 * @see org.apache.logging.log4j.Logger#exit(java.lang.Object)
	 */
	public abstract <R> R exit(R result);
	/*
	 * @see org.apache.logging.log4j.Logger#fatal(java.lang.Object)
	 */
	public abstract void fatal(Object message);
	
	/*
	 * @see org.apache.logging.log4j.Logger#fatal(java.lang.Object, java.lang.Throwable)
	 */
	public abstract void fatal(Object message, Throwable t);
	
	/*
	 * @see org.apache.logging.log4j.Logger#fatal(java.lang.String)
	 */
	public abstract void fatal(String message);
	
	/*
	 * @see org.apache.logging.log4j.Logger#fatal(java.lang.String, java.lang.Object[])
	 */
	public abstract void fatal(String message, Object... params);
	
	/*
	 * @see org.apache.logging.log4j.Logger#fatal(java.lang.String, java.lang.Throwable)
	 */
	public abstract void fatal(String message, Throwable t);
	
	/*
	 * @see org.apache.logging.log4j.Logger#getName()
	 */
	public abstract String getName();
	/*
	 * @see org.apache.logging.log4j.Logger#info(java.lang.Object)
	 */
	public abstract void info(Object message);
	
	/*
	 * @see org.apache.logging.log4j.Logger#info(java.lang.Object, java.lang.Throwable)
	 */
	public abstract void info(Object message, Throwable t);
	
	/*
	 * @see org.apache.logging.log4j.Logger#info(java.lang.String)
	 */
	public abstract void info(String message);
	
	/*
	 * @see org.apache.logging.log4j.Logger#info(java.lang.String, java.lang.Object[])
	 */
	public abstract void info(String message, Object... params);
	
	/*
	 * @see org.apache.logging.log4j.Logger#info(java.lang.String, java.lang.Throwable)
	 */
	public abstract void info(String message, Throwable t);
	
	/*
	 * @see org.apache.logging.log4j.Logger#isDebugEnabled()
	 */
	public abstract boolean isDebugEnabled();
	/*
	 * @see org.apache.logging.log4j.Logger#isErrorEnabled()
	 */
	public abstract boolean isErrorEnabled();
	/*
	 * @see org.apache.logging.log4j.Logger#isFatalEnabled()
	 */
	public abstract boolean isFatalEnabled();
	
	/*
	 * @see org.apache.logging.log4j.Logger#isInfoEnabled()
	 */
	public abstract boolean isInfoEnabled();
	/*
	 * @see org.apache.logging.log4j.Logger#isTraceEnabled()
	 */
	public abstract boolean isTraceEnabled();
	/*
	 * @see org.apache.logging.log4j.Logger#isWarnEnabled()
	 */
	public abstract boolean isWarnEnabled();
	/*
	 * @see org.apache.logging.log4j.Logger#throwing(java.lang.Throwable)
	 */
	public abstract <T extends Throwable> T throwing(T t);
	/*
	 * @see org.apache.logging.log4j.Logger#trace(java.lang.Object)
	 */
	public abstract void trace(Object message);
	
	/*
	 * @see org.apache.logging.log4j.Logger#trace(java.lang.Object, java.lang.Throwable)
	 */
	public abstract void trace(Object message, Throwable t);
	
	/*
	 * @see org.apache.logging.log4j.Logger#trace(java.lang.String)
	 */
	public abstract void trace(String message);
	
	/*
	 * @see org.apache.logging.log4j.Logger#trace(java.lang.String, java.lang.Object[])
	 */
	public abstract void trace(String message, Object... params);
	
	/*
	 * @see org.apache.logging.log4j.Logger#trace(java.lang.String, java.lang.Throwable)
	 */
	public abstract void trace(String message, Throwable t);
	/*
	 * @see org.apache.logging.log4j.Logger#warn(java.lang.Object)
	 */
	public abstract void warn(Object message);
	
	/*
	 * @see org.apache.logging.log4j.Logger#warn(java.lang.Object, java.lang.Throwable)
	 */
	public abstract void warn(Object message, Throwable t);
	/*
	 * @see org.apache.logging.log4j.Logger#warn(java.lang.String)
	 */
	public abstract void warn(String message);
	/*
	 * @see org.apache.logging.log4j.Logger#warn(java.lang.String, java.lang.Object[])
	 */
	public abstract void warn(String message, Object... params);
	/*
	 * @see org.apache.logging.log4j.Logger#warn(java.lang.String, java.lang.Throwable)
	 */
	public abstract void warn(String message, Throwable t);

}



